<template>
  <div class="page-common-layout">
    <div class="page-common-content">
      <tool-bar @search="$refs.table.refresh(true)" @reset="
          () => {
            (this.queryParam = {}), $refs.table.refresh(true);
          }
        ">
        <template slot="toolBtn" slot-scope="scope">
          <a-button class="cu-btn-primary" icon="plus" @click="handleAdd()"
                    v-action:sysGenFieldmappingAddDialog>{{$ct("add","新增")}}
          </a-button>
          <a-button class="cu-btn-danger" icon="delete" @click="handleSub($refs.table.selectedRowKeys)"
                    v-action:sysGenFieldmappingDelDialog>{{$ct("delete","删除")}}
          </a-button>
        </template>
        <template slot="toolForm">
          <a-form-item :label="$ct('databaseFieldType','数据库字段类型')">
            <a-input v-model="queryParam.filedType" :placeholder="$ct('databaseFieldType','数据库字段类型')"/>
          </a-form-item>
        </template>
      </tool-bar>
      <DataGrid ref="table" :columns="columns" :url="url" :queryParam="queryParam" rowKey="uuid">
        <template slot="renderAction" slot-scope="{ text, record }">
          <a @click="() => handleEdit(record)" v-action:sysGenFieldmappingEditDialog>{{$ct("edit","编辑")}}</a>
          <span class="action-margin"></span>
          <a @click="() => handleSub(record)" class="action-delete"
             v-action:sysGenFieldmappingDelDialog>{{$ct("delete","删除")}}</a>
        </template>
      </DataGrid>
      <edit-form ref="createModal" :visible="visible" :loading="confirmLoading" :model="mdl"
                 @cancel="handleCancel()" @ok="handleOk()"/>
    </div>
  </div>
</template>

<script>
  import {
    DataGrid
  } from "@/components";
  import {
    dataGridMixin
  } from "@/mixins/dataGridMixin";
  import editForm from "./edit.vue";

  export default {
    name: "Table",
    components: {
      DataGrid,
      editForm,
    },
    mixins: [dataGridMixin],
    data() {
      return {
        columns: [{
          title: "数据库字段类型",
          dataIndex: "filedType",
          langCode:'databaseFieldType'
        },
          {
            title: "java字段类型",
            dataIndex: "javaType",
            langCode:'javaFieldType'
          },
          {
            title: "数据库类型",
            dataIndex: "databaseType",
          },
          {
            title: "系统包名",
            dataIndex: "javaPackageName",
          },
          {
            title: "创建时间",
            dataIndex: "createTime",
          },
          {
            title: "操作",
            dataIndex: "action",
            scopedSlots: {
              customRender: "renderAction"
            },
          },
        ],
        visible: false,
        confirmLoading: false,
        mdl: null,
        // 查询参数
        queryParam: {},
        url: {
          getPageSet: "/system/sysGenFieldmapping/getPageSet",
          save: "/system/sysGenFieldmapping/save",
          update: "/system/sysGenFieldmapping/update",
          deleteBatch: "/system/sysGenFieldmapping/deleteBatch",
        },
      };
    },
    methods: {},
  };
</script>

<style lang="less" scoped="scoped">

</style>
